/////////////////////////
// 	DDBitmap.h	:	v0010
//	Written by 	:	Li	Haijun
//	Compiler	:	Microsoft Visual C++ 4.0
//	v0010		:	Nov.28.1996
/////////////////////////
// to show the special bitmap . eg : tq.bmp fx.bmp sz.bmp
/////////////////////////////////////////////////////////////////////////////
// CDButton class
#ifndef __DDBITMAP_H__
#define __DDBITMAP_H__

#include	"stdafx.h"
#include	"ddapi.h"
/////////////////////////////////////////
//	to release all bitmap when you exit one menu which include one bitmap
void	FACE_DeleteAllBitmap() ;
/////////////////////////////////////////
// to blit all bitmap . This function is write for the class CDDMenu 
void	FACE_BlitAllBitmap() ;
////////////////////////////////////////
class CDDBitmap
{
	//member
public:
// the surface that this button is load on
	CDDSurface	m_BitmapSurface;
// Attributes
private:
	SIZE	m_szOneBitmap;	// the size of one state of a bitmap
	RECT	m_rTotal;		// there is four state of a bitmap in a DIB file	
	RECT	m_rCurrent;		// the rectangle of current state bitmap button
	int		m_dwX, m_dwY;		// the position of a bitmap button on the surface
	// flags
	int  m_nID;		// bitmap id
	int  m_nState;	// bitmap state, 0->7 or 0->3 
	int  m_nPart;	// how many part should the dib image file be devided
					// that means,how many state image in one dib file
public:
	CDDBitmap();		//constructor
	~CDDBitmap();		//destructor

// Initialize the data member
public:
// Operations
public:	
	// initializes
	// to preload the bitmap by its filename id
	BOOL PreLoad(int FilenameId, int x, int y, int OneBitmapWidth=0, int OneBitmapHeight=0 , //, int part);	// always used in the contructor of its parent
						const char* bmpfilename = "bmp\\bmp.lwc", const char* listfilename = "bmp\\bmp.idx");
	// to preload the bitmap by its filename
	BOOL PreLoad(LPCTSTR lpszFilename, int x, int y, int OneBitmapWidth=0, int OneBitmapHeight=0); //, int part);	// always used in the contructor of its parent
	// attributes
	// set the state of this bitmap button
	void SetID(int ID);	//to set this button's ID
	// set the state of this bitmap button
	void SetState(int state);	// let button up or down or ...
	// to get the state of this bitmap
	int  GetState(){return m_nState;}	// get button state
	// to modify the show position of this bitmap
	void SetPosition(int x, int y);
	// to get the show position of this bitmap
	POINT GetPosition(void);
	// to get the size of this bitmap
	SIZE GetSize(void){return m_szOneBitmap;}
	// operations
	//blit the current part of image to the direct surface and show it
	void Show( );

	//////////////////////////////////////////
	// to blit all the bitmap to the back buffer
	void Blit() ;
	///////////////////////////////////////////
	//	to blit a compatible part of this bitmap to back buffer by the state
	void Blit( int ID ) ;
	///////////////////////////////////////////
	//	to blit the correctly rectangle of the source bitmap to the ancient destination point of the back buffer
	//
	// pRect -> the rectangle pointer of the part of the whole bitmap
	//
	void Blit( RECT* pRect ) ;
	//////////////////////////////////////////////////
	// to blit the correctly rectangle part of the source bitmap to a new destination point of the back buffer
	// 
	//pDest -->	the destinate point in the back buffer to blit this rect of bitmap
	//pRect --> the rectangle of bitmap should be blit on the back buffer
	void Blit( POINT* pDest, RECT* pRect ) ;
	//	to blit this bitmap to back buffer
//	void Blit( int ID=-10, RECT* pRect=NULL );

	//	to update the area of this bitmap file stay
	void Update();
	// to release this bitmap 
	void Release();
};
///////////////////////////////////////
#endif
